package com.spzx.cart.api.factory;

import com.spzx.cart.api.RemoteCartService;
import com.spzx.cart.api.domain.CartInfo;
import com.spzx.common.core.domain.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author 快点干早点散
 * @Create 2025/5/9 19:15
 * Description:
 */
@Component
@Slf4j
public class RemoteCartFallbackFactory implements FallbackFactory<RemoteCartService> {
    @Override
    public RemoteCartService create(Throwable cause) {
        return new RemoteCartService(){
            @Override
            public R<List<CartInfo>> getCartCheckedList(String source) {
                    log.error("远程调用失败:{}",cause.getMessage());
                return null;
            }
        };
    }
}
